package com.nintendo.tool;

import com.nintendo.entity.Content;
import com.nintendo.entity.Doc;
import com.nintendo.entity.Ebook;
import com.nintendo.mapper.EbookMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

@Component
@Slf4j
public class DateTool {
    @Autowired
    private EbookMapper ebookMapper;
    @Tool(description = "获取当前时间")
    public String getDate(String date) {
        log.info("==================getCurrentTime=================");
        String currentTime = String.format("当前的时间是 %s ", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        return currentTime;
    }
    @Tool(description = "根据城市所在的时区id来获得当前的时间")
    public String getCurrenTimeByZoneId(String cityName,String zoneId){
        log.info("==================getCurrenTimeByZoneId=================");
        log.info("================参数 cityName: {}=================",cityName);
        log.info("================参数 zoneId: {}=================",zoneId);
        ZoneId zone = ZoneId.of(zoneId);
        ZonedDateTime zonedDateTime = ZonedDateTime.now(zone);
        String currentTime =
                String.format("当前的时间是 %s ",zonedDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        return currentTime;
    }

}
